package 课堂作业api_day3;

import java.util.Scanner;

//1.对输入的qq号进行匹配（qq匹配规则：长度为5-10位，纯数字组成，且不能以0开头。）
public class TestDemo3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入QQ号长度为5-10位，纯数字组成，且不能以0开头:");
        String str = sc.next();
        //[1-9]\d{4,9}
        String regex = "[1-9]\\d{4,9}";
        boolean matches = str.matches(regex);
        System.out.println(matches);
    }
}
